# Maintainer: Antonio Rojas <arojas@archlinux.org>

_pyname=contourpy
pkgname=python-$_pyname
pkgver=1.2.0
pkgrel=1
pkgdesc='Python library for calculating contours in 2D quadrilateral grids'
arch=(loong64 x86_64)
url='https://github.com/contourpy/contourpy'
license=(BSD)
depends=(gcc-libs
         glibc
         python
         python-numpy)
makedepends=(meson-python
             pybind11
             python-build
             python-installer)
checkdepends=(python-matplotlib
              python-pytest
              python-wurlitzer)
optdepends=('python-matplotlib: matplotlib renderer')
source=(https://pypi.python.org/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz)
sha256sums=('171f311cb758de7da13fc53af221ae47a5877be5a0843a9fe150818c51ed276a')

prepare() {
  sed -e '/ninja/d' -i $_pyname-$pkgver/pyproject.toml
}

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pyname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
